import { http } from "@/utils/http";
import { baseUrlApi } from "@/api/utils";
type Result = {
  current_page: number;
  result?: any;
  per_page?: number;
  total?: number;
  data?: any;
};
type ResultCreate = {
  code: number;
  msg: string;
  result: any;
};
/** 企业用户管理API*/
/** 用户列表 */
export const getUserList = (params?: object) => {
  return http.request<Result>("get", baseUrlApi + "/corpUser/list", {
    params
  });
};
/** 创建 */
export const create = (data?: object) => {
  return http.request<ResultCreate>("post", baseUrlApi + "/corpUser/store", {
    data
  });
};
/** 修改 */
export const update = (data?: object) => {
  return http.request<ResultCreate>("put", baseUrlApi + "/corpUser/update", {
    data
  });
};
/** 修改密码 */
export const updatePassword = (data?: object) => {
  return http.request<Show>("put", baseUrlApi + "/corpUser/updatePassword", {
    data
  });
};
/** 删除 */
export const del = (data?: object) => {
  return http.request<ResultCreate>("delete", baseUrlApi + "/corpUser/delete", {
    data
  });
};
type Show = {
  code: number;
  msg: string;
  result?: any;
};
/** 用户详情 */
export const getUserShow = (params?: object) => {
  return http.request<Show>("get", baseUrlApi + "/corpUser/show", {
    params
  });
};
/** 用户状态修改 */
export const updateStatus = (data?: object) => {
  return http.request<ResultCreate>(
    "put",
    baseUrlApi + "/corpUser/updateStatus",
    {
      data
    }
  );
};
/** 职位列表 */
export const getJobTitleListApi = (params?: object) => {
  return http.request<Result>("get", baseUrlApi + "/jobTitle/selectOptions", {
    params
  });
};

/** 企业详情 */
export const getCorpShowApi = (params?: object) => {
  return http.request<Show>("get", baseUrlApi + "/corp/show", {
    params
  });
};

/** 企业编辑 */
export const updateCorpApi = (data?: object) => {
  return http.request<ResultCreate>("put", baseUrlApi + "/corp/update", {
    data
  });
};
